package com.googlecode.duplicatedetector.util;

import java.util.Arrays;

public class ByteWrapper {

	private final byte[] bytes;

	public ByteWrapper(byte[] bytes) {
		this.bytes = Arrays.copyOf(bytes, bytes.length);
	}

	@Override
	public boolean equals(Object obj) {
		if (!(obj instanceof ByteWrapper)) {
			return false;
		}
		return Arrays.equals(bytes, ((ByteWrapper) obj).bytes);
	}

	@Override
	public int hashCode() {
		return Arrays.hashCode(bytes);
	}
	
	@Override
	public String toString() {
		return FileUtils.hex(bytes);
	}

}
